//
//  SystemMessageTableViewCell.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/7/26.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "SystemMessageTableViewCell.h"


@interface SystemMessageTableViewCell ()

@property (nonatomic, strong)UILabel * titleLabel;

@property (nonatomic, strong)UIImageView * rightImage;



@property (nonatomic, strong)UIView * lineView;

@property (nonatomic, copy)NSString * typeString;

@end



@implementation SystemMessageTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = [UIColor clearColor];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    self.titleLabel = [UILabel new];
    
    self.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    self.titleLabel.textColor = ColorWithRGB(0xe7e7e7);
    self.titleLabel.text = @"系统消息";
    
    [self.contentView addSubview:self.titleLabel];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.centerY.mas_equalTo(self.contentView);
    }];
    
//    self.label = [UILabel new];
//    
//    self.label.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
//    self.label.textColor = ColorWithRGB(0xe7e7e7);
//    self.label.text = @"huhaha";
//    self.label.hidden = YES;
//    
//    [self.contentView addSubview:self.label];
//    
//    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.mas_equalTo(self.contentView);
//        make.centerY.mas_equalTo(self.contentView);
//    }];
    
    self.rightImage = [UIImageView new];
    
    self.rightImage.contentMode = UIViewContentModeScaleAspectFit;
    self.rightImage.image = [UIImage imageNamed:@"修改头像"];
    
    [self.contentView addSubview:self.rightImage];
    
    [self.rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.centerY.mas_equalTo(self.contentView);
        make.width.mas_equalTo(20 * SCREENH6);
        make.height.mas_equalTo(20 * SCREENH6);
    }];
    
    
    self.lineView = [UIView new];
    
    self.lineView.backgroundColor = [UIColor whiteColor];
    self.lineView.alpha = 0.1;
    
    [self.contentView addSubview:self.lineView];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1 * SCREENH6);
    }];
}


- (void)setModel:(SystemMessageListModel *)model{
    
    _model = model;
    
    self.titleLabel.text = model.title;
    self.typeString = [NSString stringWithFormat:@"%@",model.is_read];
    self.ID = [NSString stringWithFormat:@"%@",model.ID];
    
    if ([self.typeString isEqualToString:@"0"]) {
        //未读红点
        
    }else{
        
        self.rightImage.image = [UIImage imageNamed:@"修改头像"];
    }
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
